package com.vogue.supplymall.shop.domain.service.impl;

import com.vogue.supplymall.admin.business.domain.service.AdminPrivatePlatformService;
import com.vogue.supplymall.common.domain.dto.SearchInfo;
import com.vogue.supplymall.shop.common.IMemUtils;
import com.vogue.supplymall.shop.domain.service.HomePageBiz;
import com.vogue.supplymall.shop.domain.service.ShopService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * The type Home page biz.
 *
 * @aouthor: zhangliang
 * @date: Create in 2017-12-21
 */
@Service
public class HomePageBizImpl implements HomePageBiz {
    @Resource
    private ShopService shopService;
    @Resource
    private IMemUtils iMemUtils;
    @Resource
    private AdminPrivatePlatformService adminPrivatePlatformService;

    @Override
    public List<Map<String, String>> getAdministrativeArea() {
        return null;
    }

    @Override
    public List<Map<String, Object>> getCategory() {
        return null;
    }

    @Override
    public Object getShop(SearchInfo searchInfo) {
        Object shops = iMemUtils.getCityShop(searchInfo.getPosition());
//        if (null == shops) {
            shops = shopService.findBySearchInfo(searchInfo);
//            if (null != shops) {
//                iMemUtils.setCityShop(searchInfo.getPosition(), shops);
//            }
//        }
        return shops;
    }

    @Override
    public Object getPrivatePlatformInfo(SearchInfo searchInfo) {
        Object privatePlatformInfo = adminPrivatePlatformService.findByPrivatePlatformInfo(searchInfo);
        return privatePlatformInfo;
    }
}
